package com.igeek.service;

import com.igeek.dao.Userdao;
import com.igeek.domain.User;
import com.igeek.utils.MD5Utils;

public class Userservice {
    Userdao dao =new Userdao();
    public void regist(User user) {
        String pwd = user.getPassword();
        String encodePwd = MD5Utils.enCode(pwd);
        user.setPassword(encodePwd);
        dao.regist(user);
    }

    public boolean checkactiveCode(String activeCode) {
        return dao.checkactiveCode(activeCode);
    }

    public void updateactiveCode(String activeCode) {
        dao.updateactiveCode(activeCode);
    }

    public User login(User user) {
        String pwd = user.getPassword();
        String encodePwd = MD5Utils.enCode(pwd);
        user.setPassword(encodePwd);
        return dao.login(user);
    }

    public boolean checkname(String username) {
        return dao.checkname(username);
    }
}
